using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using WIT.DAQ.Core.Enums;
using WIT.DAQ.Core.Models;
using WIT.DAQ.Core.Properties;

namespace WIT.DAQ.Core.Forms;

/// <summary>
///
/// </summary>
internal class DAQTaskEditForm : BaseForm
{
	/// <summary>
	///
	/// </summary>
	/// <param name="daqTask"></param>
	internal delegate void SaveDAQTaskHandler(DAQTask daqTask);

	/// <summary>
	/// 当前操作的站点
	/// </summary>
	private readonly Station STATION;

	/// <summary>
	/// 实例化的目的
	/// </summary>
	private readonly EnumFormPurpose PURPOSE;

	/// <summary>
	/// 当次编辑的任务
	/// </summary>
	private readonly DAQTask DAQTASK;

	private const string TITLE_ADD = "添加任务";

	private const string TITLE_EDIT = "编辑任务";

	/// <summary>
	/// 标记是否有任何修改
	/// </summary>
	private bool IsDirty = false;

	/// <summary>
	/// Required designer variable.
	/// </summary>
	private IContainer components = null;

	private Label label1;

	private TextBox txtName;

	private GroupBox gbConditions;

	private GroupBox gbWritebacks;

	private Label label2;

	private ComboBox cmbTriggerMode;

	private Label label3;

	private NumericUpDown nudInterval;

	private Label label4;

	private Panel pnlLoopInterval;

	private GroupBox gbParams;

	private Button btnConfirm;

	private Button btnCancel;

	private ComboBox cmbMultiConditionStrategy;

	private DataGridView dgvConditions;

	private DataGridView dgvWritebacks;

	private DataGridView dgvParams;

	private Label label5;

	private Button btnDelCondition;

	private Button btnAddCondition;

	private Button btnDownCondition;

	private Button btnUpCondition;

	private Button btnAddParam;

	private Button btnDelParam;

	private Button btnUpWriteback;

	private Button btnDownWriteback;

	private Button btnAddWriteback;

	private Button btnDelWriteback;

	private TextBox txtClassName;

	private Label label6;

	private SplitContainer splitContainer1;

	private SplitContainer splitContainer2;

	private TextBox txtDesc;

	private Label label7;

	private Button btnUpParam;

	private Button btnDownParam;

	private TextBox txtMethodName;

	private Label lblMethodName;

	private Label label9;

	private DataGridViewTextBoxColumn DAQItem_Condition;

	private DataGridViewTextBoxColumn Operator;

	private DataGridViewTextBoxColumn Value;

	private DataGridViewTextBoxColumn DAQItem_Writeback;

	private DataGridViewTextBoxColumn Content;

	private DataGridViewTextBoxColumn ContentSource;

	private CheckBox cbNeedLog;

	private ComboBox cmbSocketServers;

	private CheckBox cbSocketMsgAsParam;

	private TextBox txtSocketMsgIdentifier;

	private Label label8;

	private Label lblSocketMsgWritebackNotice;

	private ComboBox cmbSocketMsgWritebackSource;

	private TextBox txtSocketMsgWritebackContent;

	private Label label10;

	private Label label11;

	private CheckBox cbWritebackSocketMsg;

	private Panel pnlSocketServer;

	private Label label12;

	private CheckBox cbSocketMsgWritebackIsString;

	private Panel pnlSocketWriteback;

	private Panel pnlSocketParam;

	private CheckBox cbLaunch;

	private TextBox txtNamespace;

	private Label label14;

	private Label label15;

	private Panel pnlConditionsLayer;

	private Label label13;

	private DataGridViewTextBoxColumn DAQItem_Param;

	private DataGridViewTextBoxColumn DAQItem_IsConst;

	private DataGridViewTextBoxColumn DAQItem_SingleRead;

	/// <summary>
	///
	/// </summary>
	internal event SaveDAQTaskHandler SaveDAQTask;

	/// <summary>
	///
	/// </summary>
	/// <param name="station"></param>
	/// <param name="purpose"></param>
	/// <param name="daqTask"></param>
	internal DAQTaskEditForm(Station station, EnumFormPurpose purpose, DAQTask daqTask = null)
	{
		InitializeComponent();
		dgvConditions.AutoGenerateColumns = false;
		dgvParams.AutoGenerateColumns = false;
		dgvWritebacks.AutoGenerateColumns = false;
		STATION = station;
		PURPOSE = purpose;
		DAQTASK = daqTask;
		InitTriggerModes();
		InitSocketServers();
		InitMultiConditionStrategy();
		InitSocketMsgWritebackSources();
		switch (PURPOSE)
		{
		case EnumFormPurpose.Add:
		{
			Text = "添加任务";
			Device device = Common.GetDevice(station.DefaultDeviceId);
			switch (device.Protocol)
			{
			case EnumProtocol.OPCUA:
				cmbTriggerMode.SelectedValue = EnumTaskTriggerMode.Subscribe;
				break;
			case EnumProtocol.Socket:
				cmbTriggerMode.SelectedValue = EnumTaskTriggerMode.SocketListen;
				break;
			default:
				cmbTriggerMode.SelectedValue = EnumTaskTriggerMode.Loop;
				break;
			}
			break;
		}
		case EnumFormPurpose.Edit:
			Text = "编辑任务";
			txtName.Text = DAQTASK.Name;
			cbLaunch.Checked = DAQTASK.Launch;
			cbNeedLog.Checked = DAQTASK.NeedLog;
			cmbTriggerMode.SelectedValue = DAQTASK.TriggerMode;
			if (DAQTASK.Interval.HasValue)
			{
				nudInterval.Value = Convert.ToInt32(DAQTASK.Interval);
			}
			if (DAQTASK.SocketServerId.HasValue)
			{
				cmbSocketServers.SelectedValue = DAQTASK.SocketServerId.Value;
			}
			txtDesc.Text = DAQTASK.Desc;
			cmbMultiConditionStrategy.SelectedValue = DAQTASK.MultiConditionStrategy;
			txtNamespace.Text = DAQTASK.Namespace;
			txtClassName.Text = DAQTASK.ClassName;
			txtMethodName.Text = DAQTASK.MethodName;
			dgvConditions.DataSource = new BindingList<TaskCondition>(DAQTASK.Conditions);
			dgvParams.DataSource = new BindingList<TaskParam>(DAQTASK.Params);
			cbSocketMsgAsParam.Checked = DAQTASK.SocketMsgAsParam;
			txtSocketMsgIdentifier.Text = DAQTASK.SocketMsgIdentifier;
			dgvWritebacks.DataSource = new BindingList<TaskWriteback>(DAQTASK.Writebacks);
			cbWritebackSocketMsg.Checked = DAQTASK.WritebackSocketMsg;
			txtSocketMsgWritebackContent.Text = DAQTASK.SocketMsgWritebackContent;
			cmbSocketMsgWritebackSource.SelectedValue = DAQTASK.SocketMsgWritebackSource;
			cbSocketMsgWritebackIsString.Checked = DAQTASK.SocketMsgWritebackIsString;
			break;
		}
	}

	private void DAQTaskEditForm_Load(object sender, EventArgs e)
	{
		base.WindowState = FormWindowState.Maximized;
		ToolTip toolTip = new ToolTip();
		toolTip.AutoPopDelay = 3000;
		toolTip.InitialDelay = 500;
		toolTip.ReshowDelay = 500;
		toolTip.ShowAlways = true;
		toolTip.SetToolTip(btnAddCondition, "添加触发条件");
		ToolTip toolTip2 = new ToolTip();
		toolTip2.AutoPopDelay = 3000;
		toolTip2.InitialDelay = 500;
		toolTip2.ReshowDelay = 500;
		toolTip2.ShowAlways = true;
		toolTip2.SetToolTip(btnDelCondition, "删除触发条件");
		ToolTip toolTip3 = new ToolTip();
		toolTip3.AutoPopDelay = 3000;
		toolTip3.InitialDelay = 500;
		toolTip3.ReshowDelay = 500;
		toolTip3.ShowAlways = true;
		toolTip3.SetToolTip(btnUpCondition, "上移");
		ToolTip toolTip4 = new ToolTip();
		toolTip4.AutoPopDelay = 3000;
		toolTip4.InitialDelay = 500;
		toolTip4.ReshowDelay = 500;
		toolTip4.ShowAlways = true;
		toolTip4.SetToolTip(btnDownCondition, "下移");
		ToolTip toolTip5 = new ToolTip();
		toolTip5.AutoPopDelay = 3000;
		toolTip5.InitialDelay = 500;
		toolTip5.ReshowDelay = 500;
		toolTip5.ShowAlways = true;
		toolTip5.SetToolTip(btnAddParam, "添加参数");
		ToolTip toolTip6 = new ToolTip();
		toolTip6.AutoPopDelay = 3000;
		toolTip6.InitialDelay = 500;
		toolTip6.ReshowDelay = 500;
		toolTip6.ShowAlways = true;
		toolTip6.SetToolTip(btnDelParam, "删除参数");
		ToolTip toolTip7 = new ToolTip();
		toolTip7.AutoPopDelay = 3000;
		toolTip7.InitialDelay = 500;
		toolTip7.ReshowDelay = 500;
		toolTip7.ShowAlways = true;
		toolTip7.SetToolTip(btnUpParam, "上移");
		ToolTip toolTip8 = new ToolTip();
		toolTip8.AutoPopDelay = 3000;
		toolTip8.InitialDelay = 500;
		toolTip8.ReshowDelay = 500;
		toolTip8.ShowAlways = true;
		toolTip8.SetToolTip(btnDownParam, "下移");
		ToolTip toolTip9 = new ToolTip();
		toolTip9.AutoPopDelay = 3000;
		toolTip9.InitialDelay = 500;
		toolTip9.ReshowDelay = 500;
		toolTip9.ShowAlways = true;
		toolTip9.SetToolTip(btnAddWriteback, "添加回写动作");
		ToolTip toolTip10 = new ToolTip();
		toolTip10.AutoPopDelay = 3000;
		toolTip10.InitialDelay = 500;
		toolTip10.ReshowDelay = 500;
		toolTip10.ShowAlways = true;
		toolTip10.SetToolTip(btnDelWriteback, "删除回写动作");
		ToolTip toolTip11 = new ToolTip();
		toolTip11.AutoPopDelay = 3000;
		toolTip11.InitialDelay = 500;
		toolTip11.ReshowDelay = 500;
		toolTip11.ShowAlways = true;
		toolTip11.SetToolTip(btnUpWriteback, "上移");
		ToolTip toolTip12 = new ToolTip();
		toolTip12.AutoPopDelay = 3000;
		toolTip12.InitialDelay = 500;
		toolTip12.ReshowDelay = 500;
		toolTip12.ShowAlways = true;
		toolTip12.SetToolTip(btnDownWriteback, "下移");
		ToolTip toolTip13 = new ToolTip();
		toolTip13.AutoPopDelay = 3000;
		toolTip13.InitialDelay = 500;
		toolTip13.ReshowDelay = 500;
		toolTip13.ShowAlways = true;
		toolTip13.SetToolTip(txtMethodName, "启动数据采集时，执行方法是必要的");
		ToolTip toolTip14 = new ToolTip();
		toolTip14.AutoPopDelay = 3000;
		toolTip14.InitialDelay = 500;
		toolTip14.ReshowDelay = 500;
		toolTip14.ShowAlways = true;
		toolTip14.SetToolTip(lblMethodName, "启动数据采集时，执行方法是必要的");
		txtName.Select();
	}

	private void DAQTaskEditForm_Shown(object sender, EventArgs e)
	{
		txtName.TextChanged += Form_IsDirty;
		cmbTriggerMode.SelectedIndexChanged += Form_IsDirty;
		nudInterval.ValueChanged += Form_IsDirty;
		txtDesc.TextChanged += Form_IsDirty;
		cmbMultiConditionStrategy.SelectedIndexChanged += Form_IsDirty;
		txtClassName.TextChanged += Form_IsDirty;
		txtNamespace.TextChanged += Form_IsDirty;
		txtMethodName.TextChanged += Form_IsDirty;
		cmbSocketServers.SelectedIndexChanged += Form_IsDirty;
		txtSocketMsgIdentifier.TextChanged += Form_IsDirty;
		txtSocketMsgWritebackContent.TextChanged += Form_IsDirty;
		cmbSocketMsgWritebackSource.SelectedIndexChanged += Form_IsDirty;
		IsDirty = false;
		btnConfirm.Visible = false;
	}

	/// <summary>
	/// 加载触发方式
	/// </summary>
	private void InitTriggerModes()
	{
		List<object> list = new List<object>();
		foreach (EnumTaskTriggerMode value in Enum.GetValues(typeof(EnumTaskTriggerMode)))
		{
			list.Add(new
			{
				Name = value.ToString(),
				Value = value
			});
		}
		cmbTriggerMode.DisplayMember = "Name";
		cmbTriggerMode.ValueMember = "Value";
		cmbTriggerMode.DataSource = list;
	}

	/// <summary>
	/// 加载SocketServer列表
	/// </summary>
	private void InitSocketServers()
	{
		List<Device> dataSource = (from t in Common.GetAllDevices()
			where t.Protocol == EnumProtocol.Socket
			select t).ToList();
		cmbSocketServers.DataSource = dataSource;
		cmbSocketServers.DisplayMember = "Name";
		cmbSocketServers.ValueMember = "Id";
		cmbSocketServers.SelectedIndex = -1;
	}

	/// <summary>
	/// 加载多条件触发策略
	/// </summary>
	private void InitMultiConditionStrategy()
	{
		List<object> list = new List<object>();
		foreach (EnumMultiConditionStrategy value in Enum.GetValues(typeof(EnumMultiConditionStrategy)))
		{
			list.Add(new
			{
				Name = value.ToString(),
				Value = (int)value
			});
		}
		cmbMultiConditionStrategy.DisplayMember = "Name";
		cmbMultiConditionStrategy.ValueMember = "Name";
		cmbMultiConditionStrategy.DataSource = list;
	}

	/// <summary>
	/// 触发方式下拉框选择项改变时，动态显示“循环频率”
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void cmbTriggerMode_SelectedIndexChanged(object sender, EventArgs e)
	{
		switch ((EnumTaskTriggerMode)cmbTriggerMode.SelectedValue)
		{
		case EnumTaskTriggerMode.Loop:
			pnlLoopInterval.Visible = true;
			pnlSocketServer.Visible = false;
			pnlSocketParam.Enabled = false;
			pnlSocketWriteback.Enabled = false;
			cbSocketMsgAsParam.Checked = false;
			cbWritebackSocketMsg.Checked = false;
			gbConditions.Enabled = true;
			pnlConditionsLayer.Visible = false;
			break;
		case EnumTaskTriggerMode.Subscribe:
			pnlLoopInterval.Visible = false;
			pnlSocketServer.Visible = false;
			pnlSocketParam.Enabled = false;
			pnlSocketWriteback.Enabled = false;
			cbSocketMsgAsParam.Checked = false;
			cbWritebackSocketMsg.Checked = false;
			gbConditions.Enabled = true;
			pnlConditionsLayer.Visible = false;
			cmbTriggerMode.SelectedValue = EnumTaskTriggerMode.Loop;
			break;
		case EnumTaskTriggerMode.SocketListen:
			pnlLoopInterval.Visible = false;
			pnlSocketServer.Visible = true;
			pnlSocketParam.Enabled = true;
			pnlSocketWriteback.Enabled = true;
			gbConditions.Enabled = false;
			pnlConditionsLayer.Visible = true;
			break;
		default:
			throw new Exception($"未知的触发方式[{cmbTriggerMode.SelectedValue}]");
		}
	}

	/// <summary>
	/// 添加触发条件
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btnAddCondition_Click(object sender, EventArgs e)
	{
		TaskConditionEditForm taskConditionEditForm = new TaskConditionEditForm(STATION, EnumFormPurpose.Add)
		{
			Icon = base.Icon,
			StartPosition = FormStartPosition.CenterParent
		};
		taskConditionEditForm.SaveTaskCondition += TaskConditionEditForm_AddTaskCondition;
		taskConditionEditForm.ShowDialog();
	}

	/// <summary>
	/// 添加触发条件-保存
	/// </summary>
	/// <param name="condition"></param>
	private void TaskConditionEditForm_AddTaskCondition(TaskCondition condition)
	{
		BindingList<TaskCondition> bindingList = (BindingList<TaskCondition>)dgvConditions.DataSource;
		if (bindingList == null)
		{
			bindingList = new BindingList<TaskCondition>();
		}
		bindingList.Add(condition);
		dgvConditions.DataSource = bindingList;
		dgvConditions.Rows[dgvConditions.Rows.Count - 1].Selected = true;
		Form_IsDirty(null, null);
	}

	/// <summary>
	/// 删除触发条件
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btnDelCondition_Click(object sender, EventArgs e)
	{
		DeleteCondition();
	}

	/// <summary>
	/// 按键删除触发条件
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void dgvConditions_KeyDown(object sender, KeyEventArgs e)
	{
		if (e.KeyCode == Keys.Delete)
		{
			DeleteCondition();
		}
	}

	/// <summary>
	/// 删除触发条件
	/// </summary>
	private void DeleteCondition()
	{
		if (dgvConditions.Rows.Count == 0)
		{
			return;
		}
		if (dgvConditions.SelectedRows.Count == 0)
		{
			MessageBox.Show("请选择一个触发条件", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
			return;
		}
		int index = dgvConditions.SelectedRows[0].Index;
		dgvConditions.Rows.RemoveAt(index);
		if (dgvConditions.Rows.Count > index)
		{
			dgvConditions.Rows[index].Selected = true;
		}
		else if (dgvConditions.Rows.Count > 0)
		{
			dgvConditions.Rows[index - 1].Selected = true;
		}
		Form_IsDirty(null, null);
	}

	/// <summary>
	/// 双击行编辑触发条件
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void dgvConditions_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
	{
		if (dgvConditions.SelectedRows.Count != 0)
		{
			TaskCondition condition = (TaskCondition)dgvConditions.SelectedRows[0].DataBoundItem;
			TaskConditionEditForm taskConditionEditForm = new TaskConditionEditForm(STATION, EnumFormPurpose.Edit, condition)
			{
				Icon = base.Icon,
				StartPosition = FormStartPosition.CenterParent
			};
			taskConditionEditForm.SaveTaskCondition += TaskConditionEditForm_EditTaskCondition;
			taskConditionEditForm.ShowDialog();
		}
	}

	/// <summary>
	/// 编辑触发条件-保存
	/// </summary>
	/// <param name="condition"></param>
	private void TaskConditionEditForm_EditTaskCondition(TaskCondition condition)
	{
		BindingList<TaskCondition> bindingList = (BindingList<TaskCondition>)dgvConditions.DataSource;
		int index = dgvConditions.SelectedRows[0].Index;
		bindingList[index] = condition;
		dgvConditions.DataSource = bindingList;
		Form_IsDirty(null, null);
	}

	/// <summary>
	/// 上移触发条件
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btnUpCondition_Click(object sender, EventArgs e)
	{
		if (dgvConditions.Rows.Count == 0)
		{
			return;
		}
		if (dgvConditions.SelectedRows.Count == 0)
		{
			MessageBox.Show("请选择一个触发条件", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
			return;
		}
		BindingList<TaskCondition> bindingList = (BindingList<TaskCondition>)dgvConditions.DataSource;
		int index = dgvConditions.SelectedRows[0].Index;
		if (index != 0)
		{
			TaskCondition item = bindingList[index];
			bindingList.Remove(item);
			bindingList.Insert(index - 1, item);
			dgvConditions.DataSource = bindingList;
			dgvConditions.Rows[index - 1].Selected = true;
			Form_IsDirty(null, null);
		}
	}

	/// <summary>
	/// 下移触发条件
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btnDownCondition_Click(object sender, EventArgs e)
	{
		if (dgvConditions.Rows.Count == 0)
		{
			return;
		}
		if (dgvConditions.SelectedRows.Count == 0)
		{
			MessageBox.Show("请选择一个触发条件", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
			return;
		}
		BindingList<TaskCondition> bindingList = (BindingList<TaskCondition>)dgvConditions.DataSource;
		int index = dgvConditions.SelectedRows[0].Index;
		if (index != dgvConditions.Rows.Count - 1)
		{
			TaskCondition item = bindingList[index];
			bindingList.RemoveAt(index);
			bindingList.Insert(index + 1, item);
			dgvConditions.DataSource = bindingList;
			dgvConditions.Rows[index + 1].Selected = true;
			Form_IsDirty(null, null);
		}
	}

	/// <summary>
	/// 添加参数
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btnAddParam_Click(object sender, EventArgs e)
	{
		TaskParamEditForm taskParamEditForm = new TaskParamEditForm(STATION, EnumFormPurpose.Add)
		{
			Icon = base.Icon,
			StartPosition = FormStartPosition.CenterParent
		};
		taskParamEditForm.SaveTaskParam += TaskParamEditForm_AddTaskParam;
		taskParamEditForm.ShowDialog();
	}

	/// <summary>
	/// 添加参数-保存
	/// </summary>
	/// <param name="param"></param>
	private void TaskParamEditForm_AddTaskParam(TaskParam param)
	{
		BindingList<TaskParam> bindingList = (BindingList<TaskParam>)dgvParams.DataSource;
		if (bindingList == null)
		{
			bindingList = new BindingList<TaskParam>();
		}
		bindingList.Add(param);
		dgvParams.DataSource = bindingList;
		dgvParams.Rows[dgvParams.Rows.Count - 1].Selected = true;
		Form_IsDirty(null, null);
	}

	/// <summary>
	/// 删除参数
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btnDelParam_Click(object sender, EventArgs e)
	{
		DeleteParam();
	}

	/// <summary>
	/// 按键删除参数
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void dgvParams_KeyDown(object sender, KeyEventArgs e)
	{
		if (e.KeyCode == Keys.Delete)
		{
			DeleteParam();
		}
	}

	/// <summary>
	/// 删除参数
	/// </summary>
	private void DeleteParam()
	{
		if (dgvParams.Rows.Count == 0)
		{
			return;
		}
		if (dgvParams.SelectedRows.Count == 0)
		{
			MessageBox.Show("请选择一个参数", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
			return;
		}
		int index = dgvParams.SelectedRows[0].Index;
		dgvParams.Rows.RemoveAt(index);
		if (dgvParams.Rows.Count > index)
		{
			dgvParams.Rows[index].Selected = true;
		}
		else if (dgvParams.Rows.Count > 0)
		{
			dgvParams.Rows[index - 1].Selected = true;
		}
		Form_IsDirty(null, null);
	}

	/// <summary>
	/// 双击行编辑参数
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void dgvParams_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
	{
		if (dgvParams.SelectedRows.Count != 0)
		{
			TaskParam param = (TaskParam)dgvParams.SelectedRows[0].DataBoundItem;
			TaskParamEditForm taskParamEditForm = new TaskParamEditForm(STATION, EnumFormPurpose.Edit, param)
			{
				Icon = base.Icon,
				StartPosition = FormStartPosition.CenterParent
			};
			taskParamEditForm.SaveTaskParam += TaskParamEditForm_EditTaskParam;
			taskParamEditForm.ShowDialog();
		}
	}

	/// <summary>
	/// 编辑参数-保存
	/// </summary>
	/// <param name="param"></param>
	private void TaskParamEditForm_EditTaskParam(TaskParam param)
	{
		BindingList<TaskParam> bindingList = (BindingList<TaskParam>)dgvParams.DataSource;
		int index = dgvParams.SelectedRows[0].Index;
		bindingList[index] = param;
		dgvParams.DataSource = bindingList;
		Form_IsDirty(null, null);
	}

	/// <summary>
	/// 上移参数
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btnUpParam_Click(object sender, EventArgs e)
	{
		if (dgvParams.Rows.Count == 0)
		{
			return;
		}
		if (dgvParams.SelectedRows.Count == 0)
		{
			MessageBox.Show("请选择一个参数", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
			return;
		}
		BindingList<TaskParam> bindingList = (BindingList<TaskParam>)dgvParams.DataSource;
		int index = dgvParams.SelectedRows[0].Index;
		if (index != 0)
		{
			TaskParam item = bindingList[index];
			bindingList.Remove(item);
			bindingList.Insert(index - 1, item);
			dgvParams.DataSource = bindingList;
			dgvParams.Rows[index - 1].Selected = true;
			Form_IsDirty(null, null);
		}
	}

	/// <summary>
	/// 下移参数
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btnDownParam_Click(object sender, EventArgs e)
	{
		if (dgvParams.Rows.Count == 0)
		{
			return;
		}
		if (dgvParams.SelectedRows.Count == 0)
		{
			MessageBox.Show("请选择一个参数", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
			return;
		}
		BindingList<TaskParam> bindingList = (BindingList<TaskParam>)dgvParams.DataSource;
		int index = dgvParams.SelectedRows[0].Index;
		if (index != dgvParams.Rows.Count - 1)
		{
			TaskParam item = bindingList[index];
			bindingList.RemoveAt(index);
			bindingList.Insert(index + 1, item);
			dgvParams.DataSource = bindingList;
			dgvParams.Rows[index + 1].Selected = true;
			Form_IsDirty(null, null);
		}
	}

	/// <summary>
	/// 是否将接收到的Socket消息作为参数
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void cbSocketMsgAsParam_CheckedChanged(object sender, EventArgs e)
	{
		txtSocketMsgIdentifier.Enabled = cbSocketMsgAsParam.Checked;
		Form_IsDirty(sender, e);
	}

	/// <summary>
	/// 添加回写动作
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btnAddWriteback_Click(object sender, EventArgs e)
	{
		TaskWritebackEditForm taskWritebackEditForm = new TaskWritebackEditForm(STATION, EnumFormPurpose.Add)
		{
			Icon = base.Icon,
			StartPosition = FormStartPosition.CenterParent
		};
		taskWritebackEditForm.SaveTaskWriteback += TaskWritebackEditForm_AddTaskWriteback;
		taskWritebackEditForm.ShowDialog();
	}

	/// <summary>
	/// 添加回写动作-保存
	/// </summary>
	/// <param name="writeback"></param>
	private void TaskWritebackEditForm_AddTaskWriteback(TaskWriteback writeback)
	{
		BindingList<TaskWriteback> bindingList = (BindingList<TaskWriteback>)dgvWritebacks.DataSource;
		if (bindingList == null)
		{
			bindingList = new BindingList<TaskWriteback>();
		}
		bindingList.Add(writeback);
		dgvWritebacks.DataSource = bindingList;
		dgvWritebacks.Rows[dgvWritebacks.Rows.Count - 1].Selected = true;
		Form_IsDirty(null, null);
	}

	/// <summary>
	/// 删除回写动作
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btnDelWriteback_Click(object sender, EventArgs e)
	{
		DeleteWriteback();
	}

	/// <summary>
	/// 按键删除回写动作
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void dgvWritebacks_KeyDown(object sender, KeyEventArgs e)
	{
		if (e.KeyCode == Keys.Delete)
		{
			DeleteWriteback();
		}
	}

	/// <summary>
	/// 删除回写动作
	/// </summary>
	private void DeleteWriteback()
	{
		if (dgvWritebacks.Rows.Count == 0)
		{
			return;
		}
		if (dgvWritebacks.SelectedRows.Count == 0)
		{
			MessageBox.Show("请选择一个触发条件", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
			return;
		}
		int index = dgvWritebacks.SelectedRows[0].Index;
		dgvWritebacks.Rows.RemoveAt(index);
		if (dgvWritebacks.Rows.Count > index)
		{
			dgvWritebacks.Rows[index].Selected = true;
		}
		else if (dgvWritebacks.Rows.Count > 0)
		{
			dgvWritebacks.Rows[index - 1].Selected = true;
		}
		Form_IsDirty(null, null);
	}

	/// <summary>
	/// 双击行编辑回写动作
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void dgvWritebacks_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
	{
		if (dgvWritebacks.SelectedRows.Count != 0)
		{
			TaskWriteback writeback = (TaskWriteback)dgvWritebacks.SelectedRows[0].DataBoundItem;
			TaskWritebackEditForm taskWritebackEditForm = new TaskWritebackEditForm(STATION, EnumFormPurpose.Edit, writeback)
			{
				Icon = base.Icon,
				StartPosition = FormStartPosition.CenterParent
			};
			taskWritebackEditForm.SaveTaskWriteback += TaskWritebackEditForm_EditTaskWriteback;
			taskWritebackEditForm.ShowDialog();
		}
	}

	/// <summary>
	/// 编辑回写动作-保存
	/// </summary>
	/// <param name="writeback"></param>
	private void TaskWritebackEditForm_EditTaskWriteback(TaskWriteback writeback)
	{
		BindingList<TaskWriteback> bindingList = (BindingList<TaskWriteback>)dgvWritebacks.DataSource;
		int index = dgvWritebacks.SelectedRows[0].Index;
		bindingList[index] = writeback;
		dgvWritebacks.DataSource = bindingList;
		Form_IsDirty(null, null);
	}

	/// <summary>
	/// 上移回写动作
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btnUpWriteback_Click(object sender, EventArgs e)
	{
		if (dgvWritebacks.Rows.Count == 0)
		{
			return;
		}
		if (dgvWritebacks.SelectedRows.Count == 0)
		{
			MessageBox.Show("请选择一个触发条件", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
			return;
		}
		BindingList<TaskWriteback> bindingList = (BindingList<TaskWriteback>)dgvWritebacks.DataSource;
		int index = dgvWritebacks.SelectedRows[0].Index;
		if (index != 0)
		{
			TaskWriteback item = bindingList[index];
			bindingList.Remove(item);
			bindingList.Insert(index - 1, item);
			dgvWritebacks.DataSource = bindingList;
			dgvWritebacks.Rows[index - 1].Selected = true;
			Form_IsDirty(null, null);
		}
	}

	/// <summary>
	/// 下移回写动作
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btnDownWriteback_Click(object sender, EventArgs e)
	{
		if (dgvWritebacks.Rows.Count == 0)
		{
			return;
		}
		if (dgvWritebacks.SelectedRows.Count == 0)
		{
			MessageBox.Show("请选择一个触发条件", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
			return;
		}
		BindingList<TaskWriteback> bindingList = (BindingList<TaskWriteback>)dgvWritebacks.DataSource;
		int index = dgvWritebacks.SelectedRows[0].Index;
		if (index != dgvWritebacks.Rows.Count - 1)
		{
			TaskWriteback item = bindingList[index];
			bindingList.RemoveAt(index);
			bindingList.Insert(index + 1, item);
			dgvWritebacks.DataSource = bindingList;
			dgvWritebacks.Rows[index + 1].Selected = true;
			Form_IsDirty(null, null);
		}
	}

	/// <summary>
	/// 加载Socket返回消息的来源
	/// </summary>
	private void InitSocketMsgWritebackSources()
	{
		cmbSocketMsgWritebackSource.DisplayMember = "Name";
		cmbSocketMsgWritebackSource.ValueMember = "Value";
		cmbSocketMsgWritebackSource.DataSource = TaskWriteback.ContentSources;
	}

	/// <summary>
	/// Socket返回消息的来源选择项改变时，作出相应的提示
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void cmbSocketMsgWritebackSource_SelectedIndexChanged(object sender, EventArgs e)
	{
		if (cmbSocketMsgWritebackSource.SelectedValue != null)
		{
			string text = cmbSocketMsgWritebackSource.SelectedValue.ToString();
			string text2 = text;
			if (!(text2 == "Cosnt"))
			{
				if (text2 == "Variable")
				{
					lblSocketMsgWritebackNotice.Text = "填入对应的变量名";
				}
				else
				{
					lblSocketMsgWritebackNotice.Text = string.Empty;
				}
			}
			else
			{
				lblSocketMsgWritebackNotice.Text = "回写常量";
			}
		}
		else
		{
			lblSocketMsgWritebackNotice.Text = string.Empty;
		}
	}

	/// <summary>
	/// 是否向SocketServer回写消息
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void cbWritebackSocketMsg_CheckedChanged(object sender, EventArgs e)
	{
		txtSocketMsgWritebackContent.Enabled = cbWritebackSocketMsg.Checked;
		cmbSocketMsgWritebackSource.Enabled = cbWritebackSocketMsg.Checked;
		Form_IsDirty(sender, e);
	}

	/// <summary>
	/// 确认
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btnConfirm_Click(object sender, EventArgs e)
	{
		if (string.IsNullOrEmpty(txtName.Text.Trim()))
		{
			MessageBox.Show("请输入任务名称", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
			return;
		}
		if ((EnumTaskTriggerMode)cmbTriggerMode.SelectedValue == EnumTaskTriggerMode.SocketListen && cmbSocketServers.SelectedItem == null)
		{
			MessageBox.Show("请指定需要监听的SocketServer设备", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
			return;
		}
		DAQTask dAQTask = null;
		switch (PURPOSE)
		{
		case EnumFormPurpose.Add:
			dAQTask = new DAQTask
			{
				Id = Guid.NewGuid(),
				Name = txtName.Text.Trim(),
				Launch = cbLaunch.Checked,
				NeedLog = cbNeedLog.Checked,
				StationId = STATION.Id,
				TriggerMode = (EnumTaskTriggerMode)cmbTriggerMode.SelectedValue,
				Desc = txtDesc.Text.Trim(),
				MultiConditionStrategy = cmbMultiConditionStrategy.SelectedValue.ToString(),
				Conditions = ((dgvConditions.DataSource == null) ? new List<TaskCondition>() : new List<TaskCondition>((BindingList<TaskCondition>)dgvConditions.DataSource)),
				Namespace = txtNamespace.Text.Trim(),
				ClassName = txtClassName.Text.Trim(),
				MethodName = txtMethodName.Text.Trim(),
				Params = ((dgvParams.DataSource == null) ? new List<TaskParam>() : new List<TaskParam>((BindingList<TaskParam>)dgvParams.DataSource)),
				SocketMsgAsParam = cbSocketMsgAsParam.Checked,
				SocketMsgIdentifier = txtSocketMsgIdentifier.Text.Trim(),
				Writebacks = ((dgvWritebacks.DataSource == null) ? new List<TaskWriteback>() : new List<TaskWriteback>((BindingList<TaskWriteback>)dgvWritebacks.DataSource)),
				WritebackSocketMsg = cbWritebackSocketMsg.Checked,
				SocketMsgWritebackContent = txtSocketMsgWritebackContent.Text.Trim(),
				SocketMsgWritebackSource = cmbSocketMsgWritebackSource.SelectedValue.ToString(),
				SocketMsgWritebackIsString = cbSocketMsgWritebackIsString.Checked
			};
			if (pnlLoopInterval.Visible)
			{
				dAQTask.Interval = Convert.ToInt32(nudInterval.Value);
			}
			if (pnlSocketServer.Visible)
			{
				dAQTask.SocketServerId = (Guid)cmbSocketServers.SelectedValue;
			}
			break;
		case EnumFormPurpose.Edit:
			dAQTask = DAQTASK;
			dAQTask.Launch = cbLaunch.Checked;
			dAQTask.NeedLog = cbNeedLog.Checked;
			dAQTask.Name = txtName.Text.Trim();
			dAQTask.StationId = STATION.Id;
			dAQTask.TriggerMode = (EnumTaskTriggerMode)cmbTriggerMode.SelectedValue;
			if (pnlLoopInterval.Visible)
			{
				dAQTask.Interval = Convert.ToInt32(nudInterval.Value);
			}
			else
			{
				dAQTask.Interval = null;
			}
			if (pnlSocketServer.Visible)
			{
				dAQTask.SocketServerId = (Guid)cmbSocketServers.SelectedValue;
			}
			else
			{
				dAQTask.SocketServerId = null;
			}
			dAQTask.Desc = txtDesc.Text.Trim();
			dAQTask.MultiConditionStrategy = cmbMultiConditionStrategy.SelectedValue.ToString();
			dAQTask.Conditions = ((dgvConditions.DataSource == null) ? new List<TaskCondition>() : new List<TaskCondition>((BindingList<TaskCondition>)dgvConditions.DataSource));
			dAQTask.Namespace = txtNamespace.Text.Trim();
			dAQTask.ClassName = txtClassName.Text.Trim();
			dAQTask.MethodName = txtMethodName.Text.Trim();
			dAQTask.Params = ((dgvParams.DataSource == null) ? new List<TaskParam>() : new List<TaskParam>((BindingList<TaskParam>)dgvParams.DataSource));
			dAQTask.SocketMsgAsParam = cbSocketMsgAsParam.Checked;
			dAQTask.SocketMsgIdentifier = txtSocketMsgIdentifier.Text.Trim();
			dAQTask.Writebacks = ((dgvWritebacks.DataSource == null) ? new List<TaskWriteback>() : new List<TaskWriteback>((BindingList<TaskWriteback>)dgvWritebacks.DataSource));
			dAQTask.WritebackSocketMsg = cbWritebackSocketMsg.Checked;
			dAQTask.SocketMsgWritebackContent = txtSocketMsgWritebackContent.Text.Trim();
			if (cmbSocketMsgWritebackSource.SelectedValue != null)
			{
				dAQTask.SocketMsgWritebackSource = cmbSocketMsgWritebackSource.SelectedValue.ToString();
			}
			dAQTask.SocketMsgWritebackIsString = cbSocketMsgWritebackIsString.Checked;
			break;
		}
		this.SaveDAQTask(dAQTask);
		IsDirty = false;
		Close();
	}

	/// <summary>
	/// 关闭
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void btnCancel_Click(object sender, EventArgs e)
	{
		Close();
	}

	/// <summary>
	/// 窗体内容发生变动
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void Form_IsDirty(object sender, EventArgs e)
	{
		IsDirty = true;
		btnConfirm.Visible = true;
	}

	/// <summary>
	/// 窗体关闭时提示用户保存
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void DAQTaskEditForm_FormClosing(object sender, FormClosingEventArgs e)
	{
		if (IsDirty && MessageBox.Show("更改内容后尚未保存，是否直接关闭窗口？", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
		{
			e.Cancel = true;
		}
	}

	/// <summary>
	/// Clean up any resources being used.
	/// </summary>
	/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
	protected override void Dispose(bool disposing)
	{
		if (disposing && components != null)
		{
			components.Dispose();
		}
		base.Dispose(disposing);
	}

	/// <summary>
	/// Required method for Designer support - do not modify
	/// the contents of this method with the code editor.
	/// </summary>
	private void InitializeComponent()
	{
		System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WIT.DAQ.Core.Forms.DAQTaskEditForm));
		this.label1 = new System.Windows.Forms.Label();
		this.txtName = new System.Windows.Forms.TextBox();
		this.gbConditions = new System.Windows.Forms.GroupBox();
		this.pnlConditionsLayer = new System.Windows.Forms.Panel();
		this.label13 = new System.Windows.Forms.Label();
		this.btnAddCondition = new System.Windows.Forms.Button();
		this.btnUpCondition = new System.Windows.Forms.Button();
		this.btnDelCondition = new System.Windows.Forms.Button();
		this.dgvConditions = new System.Windows.Forms.DataGridView();
		this.DAQItem_Condition = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.Operator = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.Value = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.btnDownCondition = new System.Windows.Forms.Button();
		this.cmbMultiConditionStrategy = new System.Windows.Forms.ComboBox();
		this.label5 = new System.Windows.Forms.Label();
		this.cmbSocketServers = new System.Windows.Forms.ComboBox();
		this.gbWritebacks = new System.Windows.Forms.GroupBox();
		this.pnlSocketWriteback = new System.Windows.Forms.Panel();
		this.cbSocketMsgWritebackIsString = new System.Windows.Forms.CheckBox();
		this.cbWritebackSocketMsg = new System.Windows.Forms.CheckBox();
		this.lblSocketMsgWritebackNotice = new System.Windows.Forms.Label();
		this.label11 = new System.Windows.Forms.Label();
		this.label10 = new System.Windows.Forms.Label();
		this.cmbSocketMsgWritebackSource = new System.Windows.Forms.ComboBox();
		this.txtSocketMsgWritebackContent = new System.Windows.Forms.TextBox();
		this.btnUpWriteback = new System.Windows.Forms.Button();
		this.dgvWritebacks = new System.Windows.Forms.DataGridView();
		this.DAQItem_Writeback = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.Content = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.ContentSource = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.btnDownWriteback = new System.Windows.Forms.Button();
		this.btnAddWriteback = new System.Windows.Forms.Button();
		this.btnDelWriteback = new System.Windows.Forms.Button();
		this.label2 = new System.Windows.Forms.Label();
		this.cmbTriggerMode = new System.Windows.Forms.ComboBox();
		this.label3 = new System.Windows.Forms.Label();
		this.nudInterval = new System.Windows.Forms.NumericUpDown();
		this.label4 = new System.Windows.Forms.Label();
		this.pnlLoopInterval = new System.Windows.Forms.Panel();
		this.gbParams = new System.Windows.Forms.GroupBox();
		this.txtNamespace = new System.Windows.Forms.TextBox();
		this.label14 = new System.Windows.Forms.Label();
		this.label15 = new System.Windows.Forms.Label();
		this.pnlSocketParam = new System.Windows.Forms.Panel();
		this.cbSocketMsgAsParam = new System.Windows.Forms.CheckBox();
		this.label8 = new System.Windows.Forms.Label();
		this.txtSocketMsgIdentifier = new System.Windows.Forms.TextBox();
		this.btnUpParam = new System.Windows.Forms.Button();
		this.btnDownParam = new System.Windows.Forms.Button();
		this.txtMethodName = new System.Windows.Forms.TextBox();
		this.lblMethodName = new System.Windows.Forms.Label();
		this.txtClassName = new System.Windows.Forms.TextBox();
		this.label9 = new System.Windows.Forms.Label();
		this.label6 = new System.Windows.Forms.Label();
		this.dgvParams = new System.Windows.Forms.DataGridView();
		this.btnAddParam = new System.Windows.Forms.Button();
		this.btnDelParam = new System.Windows.Forms.Button();
		this.btnConfirm = new System.Windows.Forms.Button();
		this.btnCancel = new System.Windows.Forms.Button();
		this.splitContainer1 = new System.Windows.Forms.SplitContainer();
		this.splitContainer2 = new System.Windows.Forms.SplitContainer();
		this.txtDesc = new System.Windows.Forms.TextBox();
		this.label7 = new System.Windows.Forms.Label();
		this.cbNeedLog = new System.Windows.Forms.CheckBox();
		this.pnlSocketServer = new System.Windows.Forms.Panel();
		this.label12 = new System.Windows.Forms.Label();
		this.cbLaunch = new System.Windows.Forms.CheckBox();
		this.DAQItem_Param = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.DAQItem_IsConst = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.DAQItem_SingleRead = new System.Windows.Forms.DataGridViewTextBoxColumn();
		this.gbConditions.SuspendLayout();
		this.pnlConditionsLayer.SuspendLayout();
		((System.ComponentModel.ISupportInitialize)this.dgvConditions).BeginInit();
		this.gbWritebacks.SuspendLayout();
		this.pnlSocketWriteback.SuspendLayout();
		((System.ComponentModel.ISupportInitialize)this.dgvWritebacks).BeginInit();
		((System.ComponentModel.ISupportInitialize)this.nudInterval).BeginInit();
		this.pnlLoopInterval.SuspendLayout();
		this.gbParams.SuspendLayout();
		this.pnlSocketParam.SuspendLayout();
		((System.ComponentModel.ISupportInitialize)this.dgvParams).BeginInit();
		((System.ComponentModel.ISupportInitialize)this.splitContainer1).BeginInit();
		this.splitContainer1.Panel1.SuspendLayout();
		this.splitContainer1.Panel2.SuspendLayout();
		this.splitContainer1.SuspendLayout();
		((System.ComponentModel.ISupportInitialize)this.splitContainer2).BeginInit();
		this.splitContainer2.Panel1.SuspendLayout();
		this.splitContainer2.Panel2.SuspendLayout();
		this.splitContainer2.SuspendLayout();
		this.pnlSocketServer.SuspendLayout();
		base.SuspendLayout();
		this.label1.AutoSize = true;
		this.label1.Location = new System.Drawing.Point(15, 15);
		this.label1.Name = "label1";
		this.label1.Size = new System.Drawing.Size(65, 12);
		this.label1.TabIndex = 1;
		this.label1.Text = "任务名称：";
		this.txtName.Location = new System.Drawing.Point(86, 12);
		this.txtName.MaxLength = 20;
		this.txtName.Name = "txtName";
		this.txtName.Size = new System.Drawing.Size(371, 21);
		this.txtName.TabIndex = 0;
		this.gbConditions.BackColor = System.Drawing.SystemColors.Control;
		this.gbConditions.Controls.Add(this.pnlConditionsLayer);
		this.gbConditions.Controls.Add(this.btnAddCondition);
		this.gbConditions.Controls.Add(this.btnUpCondition);
		this.gbConditions.Controls.Add(this.btnDelCondition);
		this.gbConditions.Controls.Add(this.dgvConditions);
		this.gbConditions.Controls.Add(this.btnDownCondition);
		this.gbConditions.Controls.Add(this.cmbMultiConditionStrategy);
		this.gbConditions.Controls.Add(this.label5);
		this.gbConditions.Dock = System.Windows.Forms.DockStyle.Fill;
		this.gbConditions.Location = new System.Drawing.Point(0, 0);
		this.gbConditions.Name = "gbConditions";
		this.gbConditions.Size = new System.Drawing.Size(456, 490);
		this.gbConditions.TabIndex = 0;
		this.gbConditions.TabStop = false;
		this.gbConditions.Text = "触发条件";
		this.pnlConditionsLayer.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
		this.pnlConditionsLayer.Controls.Add(this.label13);
		this.pnlConditionsLayer.Location = new System.Drawing.Point(5, 12);
		this.pnlConditionsLayer.Name = "pnlConditionsLayer";
		this.pnlConditionsLayer.Size = new System.Drawing.Size(448, 467);
		this.pnlConditionsLayer.TabIndex = 7;
		this.label13.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
		this.label13.Font = new System.Drawing.Font("微软雅黑", 10.5f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		this.label13.Location = new System.Drawing.Point(19, 96);
		this.label13.Name = "label13";
		this.label13.Size = new System.Drawing.Size(409, 110);
		this.label13.TabIndex = 0;
		this.label13.Text = "当触发方式为“SocketListen”时，则仅在接收到指定的SocketServer消息时触发此任务，其它触发条件以及触发策略将不生效。";
		this.btnAddCondition.BackgroundImage = (System.Drawing.Image)resources.GetObject("btnAddCondition.BackgroundImage");
		this.btnAddCondition.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
		this.btnAddCondition.Location = new System.Drawing.Point(6, 107);
		this.btnAddCondition.Name = "btnAddCondition";
		this.btnAddCondition.Size = new System.Drawing.Size(30, 30);
		this.btnAddCondition.TabIndex = 1;
		this.btnAddCondition.UseVisualStyleBackColor = true;
		this.btnAddCondition.Click += new System.EventHandler(btnAddCondition_Click);
		this.btnUpCondition.BackgroundImage = (System.Drawing.Image)resources.GetObject("btnUpCondition.BackgroundImage");
		this.btnUpCondition.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
		this.btnUpCondition.Location = new System.Drawing.Point(78, 107);
		this.btnUpCondition.Name = "btnUpCondition";
		this.btnUpCondition.Size = new System.Drawing.Size(30, 30);
		this.btnUpCondition.TabIndex = 3;
		this.btnUpCondition.UseVisualStyleBackColor = true;
		this.btnUpCondition.Click += new System.EventHandler(btnUpCondition_Click);
		this.btnDelCondition.BackgroundImage = global::WIT_DAQ_Core_Properties_Resour.del_black;
		this.btnDelCondition.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
		this.btnDelCondition.Location = new System.Drawing.Point(42, 107);
		this.btnDelCondition.Name = "btnDelCondition";
		this.btnDelCondition.Size = new System.Drawing.Size(30, 30);
		this.btnDelCondition.TabIndex = 2;
		this.btnDelCondition.UseVisualStyleBackColor = true;
		this.btnDelCondition.Click += new System.EventHandler(btnDelCondition_Click);
		this.dgvConditions.AllowUserToAddRows = false;
		this.dgvConditions.AllowUserToDeleteRows = false;
		this.dgvConditions.AllowUserToResizeRows = false;
		this.dgvConditions.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
		this.dgvConditions.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
		this.dgvConditions.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
		this.dgvConditions.Columns.AddRange(this.DAQItem_Condition, this.Operator, this.Value);
		this.dgvConditions.Location = new System.Drawing.Point(6, 143);
		this.dgvConditions.MultiSelect = false;
		this.dgvConditions.Name = "dgvConditions";
		this.dgvConditions.ReadOnly = true;
		this.dgvConditions.RowHeadersVisible = false;
		this.dgvConditions.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
		this.dgvConditions.RowTemplate.Height = 23;
		this.dgvConditions.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
		this.dgvConditions.Size = new System.Drawing.Size(447, 253);
		this.dgvConditions.TabIndex = 5;
		this.dgvConditions.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(dgvConditions_CellDoubleClick);
		this.dgvConditions.KeyDown += new System.Windows.Forms.KeyEventHandler(dgvConditions_KeyDown);
		this.DAQItem_Condition.DataPropertyName = "DAQItemName";
		this.DAQItem_Condition.FillWeight = 119.5432f;
		this.DAQItem_Condition.HeaderText = "采集项";
		this.DAQItem_Condition.Name = "DAQItem_Condition";
		this.DAQItem_Condition.ReadOnly = true;
		this.DAQItem_Condition.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
		this.Operator.DataPropertyName = "Operator";
		this.Operator.FillWeight = 60.9137f;
		this.Operator.HeaderText = "运算符";
		this.Operator.Name = "Operator";
		this.Operator.ReadOnly = true;
		this.Operator.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
		this.Value.DataPropertyName = "Value";
		this.Value.FillWeight = 119.5432f;
		this.Value.HeaderText = "值";
		this.Value.Name = "Value";
		this.Value.ReadOnly = true;
		this.Value.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
		this.btnDownCondition.BackgroundImage = (System.Drawing.Image)resources.GetObject("btnDownCondition.BackgroundImage");
		this.btnDownCondition.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
		this.btnDownCondition.Location = new System.Drawing.Point(114, 107);
		this.btnDownCondition.Name = "btnDownCondition";
		this.btnDownCondition.Size = new System.Drawing.Size(30, 30);
		this.btnDownCondition.TabIndex = 4;
		this.btnDownCondition.UseVisualStyleBackColor = true;
		this.btnDownCondition.Click += new System.EventHandler(btnDownCondition_Click);
		this.cmbMultiConditionStrategy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.cmbMultiConditionStrategy.FormattingEnabled = true;
		this.cmbMultiConditionStrategy.Location = new System.Drawing.Point(125, 26);
		this.cmbMultiConditionStrategy.Name = "cmbMultiConditionStrategy";
		this.cmbMultiConditionStrategy.Size = new System.Drawing.Size(121, 20);
		this.cmbMultiConditionStrategy.TabIndex = 0;
		this.label5.AutoSize = true;
		this.label5.Location = new System.Drawing.Point(27, 29);
		this.label5.Name = "label5";
		this.label5.Size = new System.Drawing.Size(101, 12);
		this.label5.TabIndex = 1;
		this.label5.Text = "多条件触发策略：";
		this.cmbSocketServers.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
		this.cmbSocketServers.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.cmbSocketServers.FormattingEnabled = true;
		this.cmbSocketServers.Location = new System.Drawing.Point(84, 1);
		this.cmbSocketServers.Name = "cmbSocketServers";
		this.cmbSocketServers.Size = new System.Drawing.Size(123, 20);
		this.cmbSocketServers.TabIndex = 1;
		this.gbWritebacks.Controls.Add(this.pnlSocketWriteback);
		this.gbWritebacks.Controls.Add(this.btnUpWriteback);
		this.gbWritebacks.Controls.Add(this.dgvWritebacks);
		this.gbWritebacks.Controls.Add(this.btnDownWriteback);
		this.gbWritebacks.Controls.Add(this.btnAddWriteback);
		this.gbWritebacks.Controls.Add(this.btnDelWriteback);
		this.gbWritebacks.Dock = System.Windows.Forms.DockStyle.Fill;
		this.gbWritebacks.Location = new System.Drawing.Point(0, 0);
		this.gbWritebacks.Name = "gbWritebacks";
		this.gbWritebacks.Size = new System.Drawing.Size(380, 490);
		this.gbWritebacks.TabIndex = 0;
		this.gbWritebacks.TabStop = false;
		this.gbWritebacks.Text = "回写动作";
		this.pnlSocketWriteback.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
		this.pnlSocketWriteback.Controls.Add(this.cbSocketMsgWritebackIsString);
		this.pnlSocketWriteback.Controls.Add(this.cbWritebackSocketMsg);
		this.pnlSocketWriteback.Controls.Add(this.lblSocketMsgWritebackNotice);
		this.pnlSocketWriteback.Controls.Add(this.label11);
		this.pnlSocketWriteback.Controls.Add(this.label10);
		this.pnlSocketWriteback.Controls.Add(this.cmbSocketMsgWritebackSource);
		this.pnlSocketWriteback.Controls.Add(this.txtSocketMsgWritebackContent);
		this.pnlSocketWriteback.Location = new System.Drawing.Point(6, 402);
		this.pnlSocketWriteback.Name = "pnlSocketWriteback";
		this.pnlSocketWriteback.Size = new System.Drawing.Size(371, 82);
		this.pnlSocketWriteback.TabIndex = 8;
		this.cbSocketMsgWritebackIsString.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
		this.cbSocketMsgWritebackIsString.AutoSize = true;
		this.cbSocketMsgWritebackIsString.Checked = true;
		this.cbSocketMsgWritebackIsString.CheckState = System.Windows.Forms.CheckState.Checked;
		this.cbSocketMsgWritebackIsString.Location = new System.Drawing.Point(227, 59);
		this.cbSocketMsgWritebackIsString.Name = "cbSocketMsgWritebackIsString";
		this.cbSocketMsgWritebackIsString.Size = new System.Drawing.Size(60, 16);
		this.cbSocketMsgWritebackIsString.TabIndex = 13;
		this.cbSocketMsgWritebackIsString.Text = "字符串";
		this.cbSocketMsgWritebackIsString.UseVisualStyleBackColor = true;
		this.cbSocketMsgWritebackIsString.CheckedChanged += new System.EventHandler(Form_IsDirty);
		this.cbWritebackSocketMsg.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
		this.cbWritebackSocketMsg.AutoSize = true;
		this.cbWritebackSocketMsg.Location = new System.Drawing.Point(0, 3);
		this.cbWritebackSocketMsg.Name = "cbWritebackSocketMsg";
		this.cbWritebackSocketMsg.Size = new System.Drawing.Size(156, 16);
		this.cbWritebackSocketMsg.TabIndex = 7;
		this.cbWritebackSocketMsg.Text = "向SocketServer回写消息";
		this.cbWritebackSocketMsg.UseVisualStyleBackColor = true;
		this.cbWritebackSocketMsg.CheckedChanged += new System.EventHandler(cbWritebackSocketMsg_CheckedChanged);
		this.lblSocketMsgWritebackNotice.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
		this.lblSocketMsgWritebackNotice.AutoSize = true;
		this.lblSocketMsgWritebackNotice.Font = new System.Drawing.Font("宋体", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
		this.lblSocketMsgWritebackNotice.ForeColor = System.Drawing.SystemColors.ControlDark;
		this.lblSocketMsgWritebackNotice.Location = new System.Drawing.Point(227, 35);
		this.lblSocketMsgWritebackNotice.Name = "lblSocketMsgWritebackNotice";
		this.lblSocketMsgWritebackNotice.Size = new System.Drawing.Size(41, 12);
		this.lblSocketMsgWritebackNotice.TabIndex = 12;
		this.lblSocketMsgWritebackNotice.Text = "notice";
		this.label11.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
		this.label11.AutoSize = true;
		this.label11.Location = new System.Drawing.Point(0, 60);
		this.label11.Name = "label11";
		this.label11.Size = new System.Drawing.Size(65, 12);
		this.label11.TabIndex = 8;
		this.label11.Text = "内容来源：";
		this.label10.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
		this.label10.AutoSize = true;
		this.label10.Location = new System.Drawing.Point(0, 33);
		this.label10.Name = "label10";
		this.label10.Size = new System.Drawing.Size(65, 12);
		this.label10.TabIndex = 7;
		this.label10.Text = "回写内容：";
		this.cmbSocketMsgWritebackSource.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
		this.cmbSocketMsgWritebackSource.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.cmbSocketMsgWritebackSource.Enabled = false;
		this.cmbSocketMsgWritebackSource.FormattingEnabled = true;
		this.cmbSocketMsgWritebackSource.Location = new System.Drawing.Point(71, 57);
		this.cmbSocketMsgWritebackSource.Name = "cmbSocketMsgWritebackSource";
		this.cmbSocketMsgWritebackSource.Size = new System.Drawing.Size(150, 20);
		this.cmbSocketMsgWritebackSource.TabIndex = 11;
		this.cmbSocketMsgWritebackSource.SelectedIndexChanged += new System.EventHandler(cmbSocketMsgWritebackSource_SelectedIndexChanged);
		this.txtSocketMsgWritebackContent.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
		this.txtSocketMsgWritebackContent.Enabled = false;
		this.txtSocketMsgWritebackContent.Location = new System.Drawing.Point(71, 30);
		this.txtSocketMsgWritebackContent.Name = "txtSocketMsgWritebackContent";
		this.txtSocketMsgWritebackContent.Size = new System.Drawing.Size(150, 21);
		this.txtSocketMsgWritebackContent.TabIndex = 10;
		this.btnUpWriteback.BackgroundImage = (System.Drawing.Image)resources.GetObject("btnUpWriteback.BackgroundImage");
		this.btnUpWriteback.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
		this.btnUpWriteback.Location = new System.Drawing.Point(78, 107);
		this.btnUpWriteback.Name = "btnUpWriteback";
		this.btnUpWriteback.Size = new System.Drawing.Size(30, 30);
		this.btnUpWriteback.TabIndex = 2;
		this.btnUpWriteback.UseVisualStyleBackColor = true;
		this.btnUpWriteback.Click += new System.EventHandler(btnUpWriteback_Click);
		this.dgvWritebacks.AllowUserToAddRows = false;
		this.dgvWritebacks.AllowUserToDeleteRows = false;
		this.dgvWritebacks.AllowUserToResizeRows = false;
		this.dgvWritebacks.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
		this.dgvWritebacks.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
		this.dgvWritebacks.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
		this.dgvWritebacks.Columns.AddRange(this.DAQItem_Writeback, this.Content, this.ContentSource);
		this.dgvWritebacks.Location = new System.Drawing.Point(6, 143);
		this.dgvWritebacks.MultiSelect = false;
		this.dgvWritebacks.Name = "dgvWritebacks";
		this.dgvWritebacks.ReadOnly = true;
		this.dgvWritebacks.RowHeadersVisible = false;
		this.dgvWritebacks.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
		this.dgvWritebacks.RowTemplate.Height = 23;
		this.dgvWritebacks.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
		this.dgvWritebacks.Size = new System.Drawing.Size(371, 253);
		this.dgvWritebacks.TabIndex = 4;
		this.dgvWritebacks.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(dgvWritebacks_CellDoubleClick);
		this.dgvWritebacks.KeyDown += new System.Windows.Forms.KeyEventHandler(dgvWritebacks_KeyDown);
		this.DAQItem_Writeback.DataPropertyName = "DAQItemName";
		this.DAQItem_Writeback.FillWeight = 111.9289f;
		this.DAQItem_Writeback.HeaderText = "采集项";
		this.DAQItem_Writeback.Name = "DAQItem_Writeback";
		this.DAQItem_Writeback.ReadOnly = true;
		this.DAQItem_Writeback.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
		this.Content.DataPropertyName = "Content";
		this.Content.FillWeight = 111.9289f;
		this.Content.HeaderText = "回写内容";
		this.Content.Name = "Content";
		this.Content.ReadOnly = true;
		this.Content.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
		this.ContentSource.DataPropertyName = "ContentSourceName";
		this.ContentSource.FillWeight = 76.14214f;
		this.ContentSource.HeaderText = "内容来源";
		this.ContentSource.Name = "ContentSource";
		this.ContentSource.ReadOnly = true;
		this.ContentSource.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
		this.btnDownWriteback.BackgroundImage = (System.Drawing.Image)resources.GetObject("btnDownWriteback.BackgroundImage");
		this.btnDownWriteback.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
		this.btnDownWriteback.Location = new System.Drawing.Point(114, 107);
		this.btnDownWriteback.Name = "btnDownWriteback";
		this.btnDownWriteback.Size = new System.Drawing.Size(30, 30);
		this.btnDownWriteback.TabIndex = 3;
		this.btnDownWriteback.UseVisualStyleBackColor = true;
		this.btnDownWriteback.Click += new System.EventHandler(btnDownWriteback_Click);
		this.btnAddWriteback.BackgroundImage = (System.Drawing.Image)resources.GetObject("btnAddWriteback.BackgroundImage");
		this.btnAddWriteback.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
		this.btnAddWriteback.Location = new System.Drawing.Point(6, 107);
		this.btnAddWriteback.Name = "btnAddWriteback";
		this.btnAddWriteback.Size = new System.Drawing.Size(30, 30);
		this.btnAddWriteback.TabIndex = 0;
		this.btnAddWriteback.UseVisualStyleBackColor = true;
		this.btnAddWriteback.Click += new System.EventHandler(btnAddWriteback_Click);
		this.btnDelWriteback.BackgroundImage = global::WIT_DAQ_Core_Properties_Resour.del_black;
		this.btnDelWriteback.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
		this.btnDelWriteback.Location = new System.Drawing.Point(42, 107);
		this.btnDelWriteback.Name = "btnDelWriteback";
		this.btnDelWriteback.Size = new System.Drawing.Size(30, 30);
		this.btnDelWriteback.TabIndex = 1;
		this.btnDelWriteback.UseVisualStyleBackColor = true;
		this.btnDelWriteback.Click += new System.EventHandler(btnDelWriteback_Click);
		this.label2.AutoSize = true;
		this.label2.Location = new System.Drawing.Point(15, 42);
		this.label2.Name = "label2";
		this.label2.Size = new System.Drawing.Size(65, 12);
		this.label2.TabIndex = 1;
		this.label2.Text = "触发方式：";
		this.cmbTriggerMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.cmbTriggerMode.FormattingEnabled = true;
		this.cmbTriggerMode.Location = new System.Drawing.Point(86, 39);
		this.cmbTriggerMode.Name = "cmbTriggerMode";
		this.cmbTriggerMode.Size = new System.Drawing.Size(150, 20);
		this.cmbTriggerMode.TabIndex = 1;
		this.cmbTriggerMode.SelectedIndexChanged += new System.EventHandler(cmbTriggerMode_SelectedIndexChanged);
		this.label3.AutoSize = true;
		this.label3.Location = new System.Drawing.Point(1, 5);
		this.label3.Name = "label3";
		this.label3.Size = new System.Drawing.Size(65, 12);
		this.label3.TabIndex = 1;
		this.label3.Text = "循环频率：";
		this.nudInterval.Increment = new decimal(new int[4] { 100, 0, 0, 0 });
		this.nudInterval.Location = new System.Drawing.Point(72, 1);
		this.nudInterval.Maximum = new decimal(new int[4] { 86400000, 0, 0, 0 });
		this.nudInterval.Minimum = new decimal(new int[4] { 100, 0, 0, 0 });
		this.nudInterval.Name = "nudInterval";
		this.nudInterval.Size = new System.Drawing.Size(80, 21);
		this.nudInterval.TabIndex = 0;
		this.nudInterval.Value = new decimal(new int[4] { 1000, 0, 0, 0 });
		this.label4.AutoSize = true;
		this.label4.Location = new System.Drawing.Point(158, 5);
		this.label4.Name = "label4";
		this.label4.Size = new System.Drawing.Size(17, 12);
		this.label4.TabIndex = 1;
		this.label4.Text = "ms";
		this.pnlLoopInterval.Controls.Add(this.nudInterval);
		this.pnlLoopInterval.Controls.Add(this.label3);
		this.pnlLoopInterval.Controls.Add(this.label4);
		this.pnlLoopInterval.Location = new System.Drawing.Point(250, 37);
		this.pnlLoopInterval.Name = "pnlLoopInterval";
		this.pnlLoopInterval.Size = new System.Drawing.Size(207, 23);
		this.pnlLoopInterval.TabIndex = 2;
		this.gbParams.Controls.Add(this.txtNamespace);
		this.gbParams.Controls.Add(this.label14);
		this.gbParams.Controls.Add(this.label15);
		this.gbParams.Controls.Add(this.pnlSocketParam);
		this.gbParams.Controls.Add(this.btnUpParam);
		this.gbParams.Controls.Add(this.btnDownParam);
		this.gbParams.Controls.Add(this.txtMethodName);
		this.gbParams.Controls.Add(this.lblMethodName);
		this.gbParams.Controls.Add(this.txtClassName);
		this.gbParams.Controls.Add(this.label9);
		this.gbParams.Controls.Add(this.label6);
		this.gbParams.Controls.Add(this.dgvParams);
		this.gbParams.Controls.Add(this.btnAddParam);
		this.gbParams.Controls.Add(this.btnDelParam);
		this.gbParams.Dock = System.Windows.Forms.DockStyle.Fill;
		this.gbParams.Location = new System.Drawing.Point(0, 0);
		this.gbParams.Name = "gbParams";
		this.gbParams.Size = new System.Drawing.Size(376, 490);
		this.gbParams.TabIndex = 0;
		this.gbParams.TabStop = false;
		this.gbParams.Text = "方法&&参数";
		this.txtNamespace.Location = new System.Drawing.Point(78, 26);
		this.txtNamespace.Name = "txtNamespace";
		this.txtNamespace.Size = new System.Drawing.Size(150, 21);
		this.txtNamespace.TabIndex = 0;
		this.label14.AutoSize = true;
		this.label14.ForeColor = System.Drawing.SystemColors.ControlDark;
		this.label14.Location = new System.Drawing.Point(234, 29);
		this.label14.Name = "label14";
		this.label14.Size = new System.Drawing.Size(89, 12);
		this.label14.TabIndex = 14;
		this.label14.Text = "可指定命名空间";
		this.label15.AutoSize = true;
		this.label15.Location = new System.Drawing.Point(7, 29);
		this.label15.Name = "label15";
		this.label15.Size = new System.Drawing.Size(65, 12);
		this.label15.TabIndex = 15;
		this.label15.Text = "命名空间：";
		this.pnlSocketParam.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
		this.pnlSocketParam.Controls.Add(this.cbSocketMsgAsParam);
		this.pnlSocketParam.Controls.Add(this.label8);
		this.pnlSocketParam.Controls.Add(this.txtSocketMsgIdentifier);
		this.pnlSocketParam.Location = new System.Drawing.Point(6, 402);
		this.pnlSocketParam.Name = "pnlSocketParam";
		this.pnlSocketParam.Size = new System.Drawing.Size(365, 82);
		this.pnlSocketParam.TabIndex = 0;
		this.cbSocketMsgAsParam.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
		this.cbSocketMsgAsParam.AutoSize = true;
		this.cbSocketMsgAsParam.Location = new System.Drawing.Point(0, 3);
		this.cbSocketMsgAsParam.Name = "cbSocketMsgAsParam";
		this.cbSocketMsgAsParam.Size = new System.Drawing.Size(132, 16);
		this.cbSocketMsgAsParam.TabIndex = 0;
		this.cbSocketMsgAsParam.Text = "Socket消息作为参数";
		this.cbSocketMsgAsParam.UseVisualStyleBackColor = true;
		this.cbSocketMsgAsParam.CheckedChanged += new System.EventHandler(cbSocketMsgAsParam_CheckedChanged);
		this.label8.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
		this.label8.AutoSize = true;
		this.label8.Location = new System.Drawing.Point(16, 34);
		this.label8.Name = "label8";
		this.label8.Size = new System.Drawing.Size(101, 12);
		this.label8.TabIndex = 1;
		this.label8.Text = "Socket消息标识：";
		this.txtSocketMsgIdentifier.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
		this.txtSocketMsgIdentifier.Enabled = false;
		this.txtSocketMsgIdentifier.Location = new System.Drawing.Point(123, 30);
		this.txtSocketMsgIdentifier.Name = "txtSocketMsgIdentifier";
		this.txtSocketMsgIdentifier.Size = new System.Drawing.Size(150, 21);
		this.txtSocketMsgIdentifier.TabIndex = 0;
		this.btnUpParam.BackgroundImage = (System.Drawing.Image)resources.GetObject("btnUpParam.BackgroundImage");
		this.btnUpParam.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
		this.btnUpParam.Location = new System.Drawing.Point(78, 107);
		this.btnUpParam.Name = "btnUpParam";
		this.btnUpParam.Size = new System.Drawing.Size(30, 30);
		this.btnUpParam.TabIndex = 5;
		this.btnUpParam.UseVisualStyleBackColor = true;
		this.btnUpParam.Click += new System.EventHandler(btnUpParam_Click);
		this.btnDownParam.BackgroundImage = (System.Drawing.Image)resources.GetObject("btnDownParam.BackgroundImage");
		this.btnDownParam.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
		this.btnDownParam.Location = new System.Drawing.Point(114, 107);
		this.btnDownParam.Name = "btnDownParam";
		this.btnDownParam.Size = new System.Drawing.Size(30, 30);
		this.btnDownParam.TabIndex = 6;
		this.btnDownParam.UseVisualStyleBackColor = true;
		this.btnDownParam.Click += new System.EventHandler(btnDownParam_Click);
		this.txtMethodName.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
		this.txtMethodName.Location = new System.Drawing.Point(78, 80);
		this.txtMethodName.Name = "txtMethodName";
		this.txtMethodName.Size = new System.Drawing.Size(292, 21);
		this.txtMethodName.TabIndex = 2;
		this.lblMethodName.AutoSize = true;
		this.lblMethodName.Location = new System.Drawing.Point(7, 83);
		this.lblMethodName.Name = "lblMethodName";
		this.lblMethodName.Size = new System.Drawing.Size(65, 12);
		this.lblMethodName.TabIndex = 12;
		this.lblMethodName.Text = "执行方法：";
		this.txtClassName.Location = new System.Drawing.Point(78, 53);
		this.txtClassName.Name = "txtClassName";
		this.txtClassName.Size = new System.Drawing.Size(150, 21);
		this.txtClassName.TabIndex = 1;
		this.label9.AutoSize = true;
		this.label9.ForeColor = System.Drawing.SystemColors.ControlDark;
		this.label9.Location = new System.Drawing.Point(234, 56);
		this.label9.Name = "label9";
		this.label9.Size = new System.Drawing.Size(65, 12);
		this.label9.TabIndex = 12;
		this.label9.Text = "可指定类名";
		this.label6.AutoSize = true;
		this.label6.Location = new System.Drawing.Point(7, 56);
		this.label6.Name = "label6";
		this.label6.Size = new System.Drawing.Size(65, 12);
		this.label6.TabIndex = 12;
		this.label6.Text = "类    名：";
		this.dgvParams.AllowUserToAddRows = false;
		this.dgvParams.AllowUserToDeleteRows = false;
		this.dgvParams.AllowUserToResizeRows = false;
		this.dgvParams.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
		this.dgvParams.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
		this.dgvParams.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
		this.dgvParams.Columns.AddRange(this.DAQItem_Param, this.DAQItem_IsConst, this.DAQItem_SingleRead);
		this.dgvParams.Location = new System.Drawing.Point(6, 143);
		this.dgvParams.MultiSelect = false;
		this.dgvParams.Name = "dgvParams";
		this.dgvParams.ReadOnly = true;
		this.dgvParams.RowHeadersVisible = false;
		this.dgvParams.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
		this.dgvParams.RowTemplate.Height = 23;
		this.dgvParams.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
		this.dgvParams.Size = new System.Drawing.Size(365, 253);
		this.dgvParams.TabIndex = 7;
		this.dgvParams.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(dgvParams_CellDoubleClick);
		this.dgvParams.KeyDown += new System.Windows.Forms.KeyEventHandler(dgvParams_KeyDown);
		this.btnAddParam.BackgroundImage = (System.Drawing.Image)resources.GetObject("btnAddParam.BackgroundImage");
		this.btnAddParam.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
		this.btnAddParam.Location = new System.Drawing.Point(6, 107);
		this.btnAddParam.Name = "btnAddParam";
		this.btnAddParam.Size = new System.Drawing.Size(30, 30);
		this.btnAddParam.TabIndex = 3;
		this.btnAddParam.UseVisualStyleBackColor = true;
		this.btnAddParam.Click += new System.EventHandler(btnAddParam_Click);
		this.btnDelParam.BackgroundImage = global::WIT_DAQ_Core_Properties_Resour.del_black;
		this.btnDelParam.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
		this.btnDelParam.Location = new System.Drawing.Point(42, 107);
		this.btnDelParam.Name = "btnDelParam";
		this.btnDelParam.Size = new System.Drawing.Size(30, 30);
		this.btnDelParam.TabIndex = 4;
		this.btnDelParam.UseVisualStyleBackColor = true;
		this.btnDelParam.Click += new System.EventHandler(btnDelParam_Click);
		this.btnConfirm.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
		this.btnConfirm.Location = new System.Drawing.Point(1053, 654);
		this.btnConfirm.Name = "btnConfirm";
		this.btnConfirm.Size = new System.Drawing.Size(75, 23);
		this.btnConfirm.TabIndex = 5;
		this.btnConfirm.Text = "确认(&S)";
		this.btnConfirm.UseVisualStyleBackColor = true;
		this.btnConfirm.Click += new System.EventHandler(btnConfirm_Click);
		this.btnCancel.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
		this.btnCancel.Location = new System.Drawing.Point(1134, 654);
		this.btnCancel.Name = "btnCancel";
		this.btnCancel.Size = new System.Drawing.Size(75, 23);
		this.btnCancel.TabIndex = 6;
		this.btnCancel.Text = "取消(&C)";
		this.btnCancel.UseVisualStyleBackColor = true;
		this.btnCancel.Click += new System.EventHandler(btnCancel_Click);
		this.splitContainer1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
		this.splitContainer1.Location = new System.Drawing.Point(1, 158);
		this.splitContainer1.Name = "splitContainer1";
		this.splitContainer1.Panel1.Controls.Add(this.gbConditions);
		this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
		this.splitContainer1.Size = new System.Drawing.Size(1220, 490);
		this.splitContainer1.SplitterDistance = 456;
		this.splitContainer1.TabIndex = 4;
		this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
		this.splitContainer2.Location = new System.Drawing.Point(0, 0);
		this.splitContainer2.Name = "splitContainer2";
		this.splitContainer2.Panel1.Controls.Add(this.gbParams);
		this.splitContainer2.Panel2.Controls.Add(this.gbWritebacks);
		this.splitContainer2.Size = new System.Drawing.Size(760, 490);
		this.splitContainer2.SplitterDistance = 376;
		this.splitContainer2.TabIndex = 0;
		this.txtDesc.Location = new System.Drawing.Point(86, 65);
		this.txtDesc.Multiline = true;
		this.txtDesc.Name = "txtDesc";
		this.txtDesc.Size = new System.Drawing.Size(371, 87);
		this.txtDesc.TabIndex = 3;
		this.label7.AutoSize = true;
		this.label7.Location = new System.Drawing.Point(15, 68);
		this.label7.Name = "label7";
		this.label7.Size = new System.Drawing.Size(65, 12);
		this.label7.TabIndex = 6;
		this.label7.Text = "描    述：";
		this.cbNeedLog.AutoSize = true;
		this.cbNeedLog.Checked = true;
		this.cbNeedLog.CheckState = System.Windows.Forms.CheckState.Checked;
		this.cbNeedLog.Location = new System.Drawing.Point(463, 14);
		this.cbNeedLog.Name = "cbNeedLog";
		this.cbNeedLog.Size = new System.Drawing.Size(72, 16);
		this.cbNeedLog.TabIndex = 7;
		this.cbNeedLog.Text = "自动日志";
		this.cbNeedLog.UseVisualStyleBackColor = true;
		this.cbNeedLog.CheckedChanged += new System.EventHandler(Form_IsDirty);
		this.pnlSocketServer.Controls.Add(this.label12);
		this.pnlSocketServer.Controls.Add(this.cmbSocketServers);
		this.pnlSocketServer.Location = new System.Drawing.Point(250, 37);
		this.pnlSocketServer.Name = "pnlSocketServer";
		this.pnlSocketServer.Size = new System.Drawing.Size(220, 23);
		this.pnlSocketServer.TabIndex = 3;
		this.label12.AutoSize = true;
		this.label12.Location = new System.Drawing.Point(1, 5);
		this.label12.Name = "label12";
		this.label12.Size = new System.Drawing.Size(77, 12);
		this.label12.TabIndex = 1;
		this.label12.Text = "Socket服务：";
		this.cbLaunch.AutoSize = true;
		this.cbLaunch.Checked = true;
		this.cbLaunch.CheckState = System.Windows.Forms.CheckState.Checked;
		this.cbLaunch.Location = new System.Drawing.Point(541, 14);
		this.cbLaunch.Name = "cbLaunch";
		this.cbLaunch.Size = new System.Drawing.Size(72, 16);
		this.cbLaunch.TabIndex = 7;
		this.cbLaunch.Text = "参与启动";
		this.cbLaunch.UseVisualStyleBackColor = true;
		this.cbLaunch.CheckedChanged += new System.EventHandler(Form_IsDirty);
		this.DAQItem_Param.DataPropertyName = "DAQItemName";
		this.DAQItem_Param.FillWeight = 49.19653f;
		this.DAQItem_Param.HeaderText = "采集项";
		this.DAQItem_Param.Name = "DAQItem_Param";
		this.DAQItem_Param.ReadOnly = true;
		this.DAQItem_Param.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
		this.DAQItem_IsConst.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
		this.DAQItem_IsConst.DataPropertyName = "IsConstShowText";
		this.DAQItem_IsConst.FillWeight = 99.97736f;
		this.DAQItem_IsConst.HeaderText = "是否为常量";
		this.DAQItem_IsConst.Name = "DAQItem_IsConst";
		this.DAQItem_IsConst.ReadOnly = true;
		this.DAQItem_IsConst.Resizable = System.Windows.Forms.DataGridViewTriState.False;
		this.DAQItem_IsConst.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
		this.DAQItem_IsConst.Width = 120;
		this.DAQItem_SingleRead.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
		this.DAQItem_SingleRead.DataPropertyName = "SingleReadShowText";
		this.DAQItem_SingleRead.FillWeight = 153.7875f;
		this.DAQItem_SingleRead.HeaderText = "是否单独读取";
		this.DAQItem_SingleRead.Name = "DAQItem_SingleRead";
		this.DAQItem_SingleRead.ReadOnly = true;
		this.DAQItem_SingleRead.Resizable = System.Windows.Forms.DataGridViewTriState.False;
		this.DAQItem_SingleRead.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
		this.DAQItem_SingleRead.Width = 120;
		base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		base.ClientSize = new System.Drawing.Size(1221, 689);
		base.Controls.Add(this.pnlLoopInterval);
		base.Controls.Add(this.cbLaunch);
		base.Controls.Add(this.cbNeedLog);
		base.Controls.Add(this.txtDesc);
		base.Controls.Add(this.label7);
		base.Controls.Add(this.splitContainer1);
		base.Controls.Add(this.btnConfirm);
		base.Controls.Add(this.btnCancel);
		base.Controls.Add(this.cmbTriggerMode);
		base.Controls.Add(this.txtName);
		base.Controls.Add(this.label2);
		base.Controls.Add(this.label1);
		base.Controls.Add(this.pnlSocketServer);
		this.MinimumSize = new System.Drawing.Size(800, 600);
		base.Name = "DAQTaskEditForm";
		this.Text = "DAQTaskEditForm";
		base.FormClosing += new System.Windows.Forms.FormClosingEventHandler(DAQTaskEditForm_FormClosing);
		base.Load += new System.EventHandler(DAQTaskEditForm_Load);
		base.Shown += new System.EventHandler(DAQTaskEditForm_Shown);
		this.gbConditions.ResumeLayout(false);
		this.gbConditions.PerformLayout();
		this.pnlConditionsLayer.ResumeLayout(false);
		((System.ComponentModel.ISupportInitialize)this.dgvConditions).EndInit();
		this.gbWritebacks.ResumeLayout(false);
		this.pnlSocketWriteback.ResumeLayout(false);
		this.pnlSocketWriteback.PerformLayout();
		((System.ComponentModel.ISupportInitialize)this.dgvWritebacks).EndInit();
		((System.ComponentModel.ISupportInitialize)this.nudInterval).EndInit();
		this.pnlLoopInterval.ResumeLayout(false);
		this.pnlLoopInterval.PerformLayout();
		this.gbParams.ResumeLayout(false);
		this.gbParams.PerformLayout();
		this.pnlSocketParam.ResumeLayout(false);
		this.pnlSocketParam.PerformLayout();
		((System.ComponentModel.ISupportInitialize)this.dgvParams).EndInit();
		this.splitContainer1.Panel1.ResumeLayout(false);
		this.splitContainer1.Panel2.ResumeLayout(false);
		((System.ComponentModel.ISupportInitialize)this.splitContainer1).EndInit();
		this.splitContainer1.ResumeLayout(false);
		this.splitContainer2.Panel1.ResumeLayout(false);
		this.splitContainer2.Panel2.ResumeLayout(false);
		((System.ComponentModel.ISupportInitialize)this.splitContainer2).EndInit();
		this.splitContainer2.ResumeLayout(false);
		this.pnlSocketServer.ResumeLayout(false);
		this.pnlSocketServer.PerformLayout();
		base.ResumeLayout(false);
		base.PerformLayout();
	}
}
